Skip to content

test(codec): add tests for raw and tar codecs#450

Merged
bergwolf merged 2 commits intomodelpack:mainfrom
rishi-jat:test/codec-tests
Mar 11, 2026
Merged

test(codec): add tests for raw and tar codecs#450
bergwolf merged 2 commits intomodelpack:mainfrom
rishi-jat:test/codec-tests

Conversation

@rishi-jat
Copy link
Contributor

Summary

Add test coverage for the codec package.

This PR introduces tests for:

  • raw codec encode/decode behavior
  • tar codec archive and extraction
  • roundtrip verification
  • invalid input handling

The tests use temporary directories (t.TempDir) and do not modify any
existing production code.

Signed-off-by: Rishi Jat <rishijat098@gmail.com>
Copilot AI review requested due to automatic review settings March 11, 2026 00:16
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of the codec package by introducing comprehensive unit tests for both the raw and tar codecs. These tests validate core functionalities like encoding, decoding, archiving, and extraction, ensuring data integrity and correct behavior under various conditions, including invalid inputs. This addition improves code quality and prevents regressions without altering existing production logic.

Highlights

  • New Test Coverage: Added comprehensive test coverage for the codec package, specifically targeting the raw and tar codecs.
  • Raw Codec Tests: Introduced tests for raw codec's encode/decode behavior, including handling of empty content and invalid input.
  • Tar Codec Tests: Implemented tests for tar codec's archiving of single and multiple files, extraction, and roundtrip verification, as well as invalid archive handling.
  • Isolated Testing: All new tests utilize t.TempDir() to ensure isolated and clean test environments without modifying production code.
Changelog
  • pkg/codec/codec_test.go
    • Added a new test file to cover raw and tar codecs.
Activity
  • No activity has been recorded yet for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@rishi-jat
Copy link
Contributor Author

/cc @chlins
/cc @aftersnow
/cc @bergwolf
/cc @avinashsingh77

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit tests for the pkg/codec package to validate raw and tar codec encode/decode behavior, including roundtrips and invalid input handling.

Changes:

  • Introduces raw codec tests for encode/decode, empty inputs, and error propagation.
  • Introduces tar codec tests for archiving/extraction (single file + directory) and invalid archives.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a comprehensive set of tests for the raw and tar codecs, covering encoding, decoding, roundtrips, and error handling. The tests are well-written and use temporary directories effectively. My main feedback is to suggest adding t.Parallel() to each test function to allow them to run in parallel, which can speed up the test suite. This is a common Go testing practice for tests that do not have side effects on each other.

Signed-off-by: Rishi Jat <rishijat098@gmail.com>
Copy link
Member

@bergwolf bergwolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@bergwolf bergwolf merged commit 9bfd4a4 into modelpack:main Mar 11, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants